<?php $this->headTitle('Branch');  ?>

<?php if(!empty($this->returnMessageSuccess)): ?>
<div class="success"><?php echo $this->escape($this->returnMessageSuccess[0]); ?></div>
<?php endif; ?>

<?php if(!empty($this->returnMessageWarning)): ?>
<div class="warning"><?php echo $this->escape($this->returnMessageWarning[0]); ?></div>
<?php endif; ?>

<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('images/setting.png');">Branch</h1>
    <div class="buttons">
        <a onclick="location = '<?php echo $this->url(array('do'=>'insert'),'systemBranch',true); ?>'" class="button"><span>Insert</span></a>
        <a class="button" id="delete"><span>Delete</span></a>
    </div>
  </div>
  <div class="content">
      <form action="<?php echo $this->url(array('do'=>'delete'),'systemBranch',true); ?>" method="post" enctype="multipart/form-data" id="form" autocomplete="off">
      <input type="hidden" name="redir" value="<?php echo $this->requestUri(); ?>">
      <table class="list">
        <thead>
          <tr>
            <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
            <td class="left">
                <?php if((isset($this->data['sort'])) && ($this->data['sort'] == 'name')): ?>
                <a href="<?php echo $this->url(array('do'=>'access'),'systemBranch',true). "?sort=name". $this->partHeadUrl; ?>" class="<?php echo strtolower($this->data['order']); ?>">Branch Name</a>
                <?php else: ?>
                <a href="<?php echo $this->url(array('do'=>'access'),'systemBranch',true). "?sort=name". $this->partHeadUrl; ?>">Branch Name</a>
                <?php endif; ?>
            </td>
            <td class="right">Action</td>
          </tr>
        </thead>
        <tbody>
            <?php if($this->branches): ?>

                    <?php foreach($this->branches as $branch): ?>
                      <tr>
                        <td style="text-align: center;"><input type="checkbox" name="selected[]" value="<?php echo $branch->branchId; ?>" /></td>
                        <td class="left"><?php echo $this->escape($branch->name); ?></td>
                        <td class="right">[ <a href="<?php echo $this->url(array('do'=>'update','id'=>$branch->branchId),'systemBranch',true)."?redir=".urlencode($this->requestUri()); ?>">View / Edit</a> ]</td>
                      </tr>
        <?php endforeach; ?>

	<?php else: ?>
          <tr>
            <td class="center" colspan="3">No results!</td>
          </tr>
       <?php endif; ?>
        </tbody>
      </table>
      </form>
      <?php if($this->branches instanceof Zend_Paginator):?>
          <?php echo $this->paginationControl(
                            $this->branches,
                            'Sliding',
                            '_paginator.phtml',
                            array('url'=>$this->url(array('do'=>'access'),'systemBranch',true),
                                  'partUrl'=>$this->partPaginationUrl,
                            )
                            );
          ?>
      <?php endif ?>
  </div>
</div>